package com.idis.common.dictionary;

import com.idis.common.base.BaseCode;

/**
 * Created by Ming on 2018/1/26.
 */

/**
 * 登录用户的权限代码及其定义
 */
public enum UserRole implements BaseCode {

    SUPER_ADMIN(2,"SUPER_ADMIN"),

    ADMIN(1,"ADMIN");

    private int code;

    private String msg;

    UserRole(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String getRole(int num){
        for (UserRole role: UserRole.values()) {
            if(role.code==num)
                return role.msg;
        }
        return "ADMIN";
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return msg;
    }

}
